home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / dev / amos / AMOSL0495.lzh / AMOSLIST / 000016_amos-request@svcs1.digex.net_Wed Apr 5 03:59:42 1995.msg < prev    next >
Internet Message Format  |  1995-05-01  |  3KB

  1. Received: from svcs1.digex.net by nfs1.digex.net with SMTP id AA21479
  2.   (5.67b8/IDA-1.5); Wed, 5 Apr 1995 03:59:40 -0400
  3. Received: by svcs1.digex.net id AA20748
  4.   (5.67b8/IDA-1.5 for amos-out); Tue, 4 Apr 1995 22:19:34 -0400
  5. Received: from nfs1.digex.net by svcs1.digex.net with SMTP id AA20744
  6.   (5.67b8/IDA-1.5 for <amos@svcs1.digex.net>); Tue, 4 Apr 1995 22:19:33 -0400
  7. Received: from goober.mbhs.edu by nfs1.digex.net with SMTP id AA05516
  8.   (5.67b8/IDA-1.5 for <amos-list@access.digex.net>); Tue, 4 Apr 1995 22:19:31 -0400
  9. Received: from dragon.mbhs.edu by goober.mbhs.edu (AIX 3.2/UCB 5.64/4.03)
  10.           id AA36053; Tue, 4 Apr 1995 22:21:10 -0400
  11. Date: Tue, 4 Apr 1995 22:21:10 -0400
  12. Message-Id: <9504050221.AA36053@goober.mbhs.edu>
  13. From: achurch@dragon.mbhs.edu (Andy Church)
  14. To: amos-list@access.digex.net
  15. Subject: Re: stdin/stdout
  16. Reply-To: achurch@goober.mbhs.edu
  17. X-Mailer: MMail v4.20
  18. Status: O
  19. X-Status: 
  20.  
  21. >> Does anyone know how to hit the STDIN and STDOUT on the amiga?  I need to
  22. >> access them from Amos.  Where do I poke/peek to read the info and send info?
  23. >
  24. >Well, I'm not sure what you mean. Because of the Amiga's ability to have 
  25. >more than one screen open at a time, there really isn't a standard place 
  26. >for input and output.
  27.  
  28.   No, no... he means "standard input" and "standard output" as in any other
  29. language.  When you run a program from a shell window, standard input and
  30. standard output are the shell window.  As for reading/writing them, you'd
  31. have to use DOS function calls.  To write to stdout:
  32.  
  33. Procedure STDOUT[A$]
  34.     FILE=Doscall(-60) : Rem Get stdout file handle
  35.     If FILE : Rem Only do this if we have a stdout
  36.     Dreg(1)=FILE
  37.     Dreg(2)=Varptr(A$)
  38.     Dreg(3)=Len(A$)
  39.     DUMMY=Doscall(-48)
  40.     End If
  41. End Proc
  42.  
  43.   Reading from stdin is more complicated:
  44.  
  45. Procedure STDIN_CHAR
  46.     FILE=Doscall(-54)
  47.     If FILE
  48.     C$=" "
  49.     Dreg(1)=FILE
  50.     Dreg(2)=Varptr(C$)
  51.     Dreg(3)=1
  52.     N=Doscall(-42)
  53.     If N=0 : Rem Check for EOF
  54.         C$=""
  55.     End If
  56.     Else
  57.     C$=""
  58.     End If
  59. End Proc[C$]
  60.  
  61. Procedure STDIN_LINE
  62.     FILE=Doscall(-54)
  63.     If FILE
  64.     A$=""
  65.     STDIN_CHAR : C$=Param$
  66.     While C$<>Chr$(13) and Len(C$)>0
  67.         A$=A$+C$
  68.         STDIN_CHAR : C$=Param$
  69.     Wend
  70.     Else
  71.     A$=""
  72.     End If
  73. End Proc[A$]
  74.  
  75.   Disclaimer: these haven't been tested - in fact, I just now came up with
  76. them.
  77.  
  78.   --Andy Church (achurch@goober.mbhs.edu)
  79.     WWW: http://www.mbhs.edu/~achurch/
  80.     AMOS Web Site: http://www.mbhs.edu/~achurch/amos/